<!DOCTYPE HTML>
<html>
<head>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
</head>
<body>
<script>

    if (window.ActiveXObject) {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    }

    if (xhr != null) {
        xhr.open("GET", 'version_test.json');
        xhr.send(null);
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                var data = JSON.parse(xhr.responseText);

                console.log(xhr.responseText);
                console.log(data);

                var url = location.href;
                var rep = url.search("\\?") == -1 ? "test.html" : "test.html?";
                var uri = url.replace(rep, data.version + "/index.html?accessType=test&");
                console.log(uri);
                location.href = uri;
            }
        };
    }
</script>
</body>
</html>